package com.charm.bulkcomponent

import android.util.Log
import com.alibaba.android.arouter.launcher.ARouter
import com.charm.codes.FkApplication
import com.tencent.smtt.sdk.QbSdk

/**
 * Created by tools on 2018/1/2.
 */
class ArouApplication : FkApplication() {
    override fun init() {
        isIntegrated = BuildConfig.IS_INTEGRATED
        initRouter()
        val cb = object : QbSdk.PreInitCallback {

            override fun onViewInitFinished(arg0: Boolean) {
                // TODO Auto-generated method stub
                //x5內核初始化完成的回调，为true表示x5内核加载成功，否则表示x5内核加载失败，会自动切换到系统内核。
                Log.d("app", " onViewInitFinished is " + arg0)
            }

            override fun onCoreInitFinished() {
                Log.d("app", " onViewInitFinished is ")
            }
        }
        QbSdk.initX5Environment(applicationContext,
                cb)
    }


    private fun initRouter() {
        if (BuildConfig.DEBUG) {
            ARouter.openLog()
            ARouter.openDebug()
        }
        ARouter.init(this)
    }
}